<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"                
                xmlns:composite="http://java.sun.com/jsf/composite">
    <composite:interface>        
        <composite:attribute name="id" type="java.lang.String" required="true"/>
        <composite:attribute name="title"/>
        <composite:attribute name="beforeclose" default="function(){}"/>
    </composite:interface>

    <composite:implementation>

        <div id="#{cc.clientId}-dialog" style="cursor: default;display:none" class="ds-dialog" title="#{cc.attrs.title}">
            <div class="ds-dialog-max-window-height" style="overflow: auto;">
               <composite:insertChildren/>
            </div>
        </div>
        <!-- TODO: check if this here should be jQuery(document)... -->
        <script type="text/javascript">jQuery(deltaset.dialog('#{cc.clientId}').register('#{cc.clientId}-dialog').beforeclose(#{cc.attrs.beforeclose}));</script>
        <script>jQuery('.ds-dialog-max-window-height').css('max-height',jQuery(window).height()-50).css('max-width',jQuery(window).width()-50)</script>
        <ui:remove>
            the javascript is not used; but for now I want to keep it in the source.
            <script type="text/javascript">    
    function #{cc.attrs.id}Open(data) {
        if("success"==data.status){
            deltaset.dialog('#{cc.clientId}').open();
        }
    }
    function #{cc.attrs.id}Close(data) {
        if("success"==data.status){
            deltaset.dialog('#{cc.clientId}').keepOrClose();
        }
    }
            </script>
        </ui:remove>
    </composite:implementation>
</ui:composition>